﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

public partial class UploadQuangCao : System.Web.UI.Page
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void btn_Upload_Click(object sender, EventArgs e)
    {
        string strFileName;

        lb_TenFile.Text = FileUpload1.PostedFile.FileName;
        lb_KieuFile.Text = FileUpload1.PostedFile.ContentType;
        lb_KichThuot.Text = FileUpload1.PostedFile.ContentLength + " KB";
        lb_ThongBao.Visible = true;
        string tenfile = Path.GetFileName(FileUpload1.PostedFile.FileName);
        try
        {
            if(FileUpload1.PostedFile!=null)
            {
                strFileName = FileUpload1.PostedFile.FileName;
                strFileName = strFileName.Substring(strFileName.LastIndexOf("\\") + 1);
                FileUpload1.PostedFile.SaveAs(Server.MapPath(".") + "\\Image\\QuangCao\\" + strFileName);
            }
            
        }
        catch
        {
            lb_ThongBao.Text = "UpLoad thất bại";
        }
    }
}
